/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.mcx.modules.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.sql.Timestamp;

@Entity
@Data
@Table(name="gameserver")
public class Gameserver implements Serializable {

    @Id
    @Column(name = "Id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @Column(name = "Status")
    private Integer status;

    @Column(name = "RunStatus")
    private Integer runstatus;

    @Column(name = "IsCommand")
    private Boolean iscommand;

    @Column(name = "IsNew")
    private Boolean isnew;

    @Column(name = "Name")
    private String name;

    @Column(name = "Ip")
    private String ip;

    @Column(name = "Port")
    private Integer port;

    @Column(name = "CreateTime")
    @NotNull
    private Timestamp createtime;

    @Column(name = "UpdateTime")
    private Timestamp updatetime;

    public void copy(Gameserver source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}